let getDouble = (n) => n * 2;
let obj = {};
let count = 1;
let double = getDouble(count);

let proxy = new Proxy(obj, {
    get(target, prop) {
        return target[prop];
    },

    set(target, prop, value) {
        target[prop] = value;
        if (prop === 'count') {
            double = getDouble(value);
        }
    },

    deleteProperty(target, prop) {
        delete target[prop];

        if (prop === 'count') {
            double = NaN;
        }
    },
});

console.log(obj.count, double);
proxy.count = 2;
console.log(obj.count, double);
delete proxy.count;
console.log(obj.count, double);
